home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00083_Script_UniUltra2 < prev    next >
Text File  |  1999-03-19  |  1KB  |  45 lines

  1. property sprAnima, periodo, tempo, prefixo 
  2. property numAnimacoes, numAnima
  3.  
  4. on getBehaviorDescription
  5.   return "Troca animacoes de sprites (a primeira ja deve estar setada)"
  6. end
  7.  
  8. on getPropertyDescriptionList
  9.   set p_list = [ ¼
  10.     #sprAnima: [ #comment: "Sprite com animacao",¼
  11.                       #format: #integer,¼
  12.                      #default: 0 ],¼
  13.     #periodo: [ #comment: "Periodo antes da troca",¼
  14.                       #format: #integer,¼
  15.                      #default: 600 ],¼
  16.     #prefixo: [ #comment: "Prefixo",¼
  17.                      #format: #string,¼
  18.                      #default: "Anima" ],¼
  19.     #numAnimacoes: [ #comment: "Numero de animacoes",¼
  20.                      #format: #integer,¼
  21.                      #default: 2 ]¼
  22.   ]
  23.   return p_list
  24. end
  25.  
  26. on beginSprite me
  27.   if sprAnima = 0 then set sprAnima = the spriteNum of me
  28.   set tempo = 0
  29.   set numAnima = 1
  30. end 
  31.  
  32. on idleSprite
  33.   if tempo = 0 then set tempo = the timer
  34.   
  35.   if the timer - tempo > periodo then
  36.     set numAnima = numAnima + 1
  37.     if numAnima > numAnimacoes then set numAnima = 1
  38.     set nomePrim = prefixo & numAnima & "-prim"
  39.     set nomeUlt = prefixo & numAnima & "-ult"
  40.     set the memberPrim of sprite sprAnima to nomePrim
  41.     set the memberUlt of sprite sprAnima to nomeUlt
  42.     sendSprite(sprAnima,#inicializaAnima)
  43.     set tempo = the timer
  44.   end if
  45. end